home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-10-13 | 5.8 KB | 121 lines | [TEXT/MPS ] |
- This is an evolution of the original traffic light Sample, circa 1988. This version
- requires 6.0.7 or later and supports the following features:
-
- • Multiple documents
- • Changeable document content
- • Correct human interface for changing document content
- • Handles the four required Apple Events
- • Supports stationery
- • Decent memory management
- • A preferences file and editable preferences
- • Works with both MPW and THINK Pascal
-
- Although this release is complete, it has version 3.0b10 because there is a version
- in C coming. Some of the same files will be used and revised for that version, and
- I have this phobia about changing a component without changing the version number.
- The C version will be a routine-for-routine translation of this version, and when
- that's done, the version will be 3.0. (It seems everyone did their own 2.0 version
- of this, so we officially skipped it.) The C version will compile with universal
- headers for PowerPC development.
-
- For directions on using Sample with THINK Pascal, see the end of this file.
-
- ----
- This section is for people who've seen the previous version of Sample.
-
- Your first reaction is probably "YOW!", followed soon by "Who the heck are you,
- and what did you do to this Sample? It used to be small and understandable,
- and now it's big and huge and large."
-
- Well, it's not that big, but it's a lot larger than it used to be. So is the
- Macintosh, which is most of the reason.
-
- This started out a couple of years ago when I was still new to Macintosh, but
- not to Desktop, programming. Some people had asked for some updates to the
- traffic light sample, and it seemed like a decent learning project for someone
- needing to refine his Macintosh skills.
-
- The list of things to do wasn't very large:
-
- • Support the four required Apple events
- • Have preferences
- • Support only 6.0.7 and later (dump code checking for 5.x systems and earlier)
- • Always use the proper human interface and compatibility guidelines, including
- supporting localization and international markets
-
- I didn't think this would be a big deal, even though I'd never written a multiple-
- document application before. I knew _how_, I just hadn't done it. Silly boy.
-
- The first requirement was the real killer. To support open and print events
- properly, you have to have documents. If you have documents, they have to have
- distinguishable content -- they shouldn't all look alike. If the user can modify
- the content, there has to be a workable user interface.
-
- If you save files, you have to have icon suites. This alone has taken years on
- some projects.
-
- So, in between doing my normal work, I worked on this. I started in Pascal
- because I wasn't fully fluent in either Pascal or C at the time, and I had to
- look up less Pascal to get code written. Besides, the Pascal compiler catches
- a lot of errors that the C compiler will let through, and for a learner, that's
- a very good thing. I write almost all in C these days, but I kept plugging on this,
- refining the interface and structure until basically my manager said "Ship it or
- we're going to do something evil to you."
-
- So here it is. I could hack on this forever -- adding the Apple Event Object Model,
- scriptability, QuickDraw GX support, mailer support, etc. I will add some of this
- stuff as time goes by, but as it stands, it's a pretty decent little sample. It
- could be a shell for a small application, though that's not exactly what it's
- intended for. There are other, more robust shells available for those purposes.
- This sample just shows how one person built a Macintosh application almost from
- scratch and tried to keep it modular so he could reuse some of the code later.
-
- I invite your comments to AppleLink address DEVSUPPORT, or DEATHERAGE1.
-
- ---
-
- How to make this run under THINK Pascal:
-
- Much of this sample was developed under THINK Pascal, though the last month or so
- of development was under MPW. MPW Pascal has some things going for it, including
- the "-u" option which sets all uninitialized variables to $7267, which makes it
- easy to find them in debugging. Very cool.
-
- THINK Pascal automatically manages UNITs correctly -- if you change something in
- a UNIT's INTERFACE, all code which USES that UNIT is rebuilt. If you change
- something in the IMPLEMENTATION, only that UNIT is rebuilt. MPW doesn't have
- this concept, so it's done by placing the IMPLEMENTATION in a separate source
- file that's included by the main file. This is how the files and the makefile
- are structure.
-
- THINK Pascal doesn't support included files, or some of the MPW Pascal directives.
- Therefore, it's _very_ important that you follow these steps to get the source
- building under THINK Pascal.
-
- 1. USE THE GENERIC SCRIPT OF THE PASCAL SOURCE CONVERTER SUPPLIED WITH THINK PASCAL
- TO CONVERT THE SOURCE FILES TO THINK FORMAT. If you don't do this, all the
- comments will be formatted poorly (MPW allows comments to span lines), the
- directives will not be correct, and the files won't build. Using this one
- simple step fixes all this, so thank Symantec for their kindness.
-
- 2. BUILD A PROJECT FILE. One is enclosed that you can use, although you might have
- to tell THINK Pascal where some of the interface files are. If you do, be
- sure to pick the interfaces in the THINK folder, and not other versions. THINK
- has many definitions built into the compiler, and picking later, conflicting
- interface files for the project can confuse things.
-
- 3. DEFINE SystemSixOrLater TO TRUE IN THE PROJECT FILE. This makes the right
- interfaces compile in some cases.
-
- 4. USE SAREZ TO BUILD THE RESOURCE FILE FOR THE PROJECT. If you'd prefer to use
- a resource editor, build it once and use the resource editor. A built version
- of just the resource file is enclosed. Name it "Sample.rsrc" for the project
- file supplied.
-
- That's it -- the project is ready to build and run!
-
- ---
-
- Matt Deatherage
- Developer Support Center
- October, 1993